﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Simple_Events_Server
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            leetSocket1.startListening();

            textBox1.Text += "Started Listening" + Environment.NewLine;
        }

        private void leetSocket1_OnDisconnectEVENT()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate() { leetSocket1_OnDisconnectEVENT(); }));
                return;
            }

            textBox1.Text += "Client Disconnected" + Environment.NewLine;
        }

        private void leetSocket1_OnBeingConnectedToEVENT()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate() { leetSocket1_OnBeingConnectedToEVENT(); }));
                return;
            }

            textBox1.Text += "Client Connected" + Environment.NewLine;
        }

        private void leetSocket1_OnExceptionEVENT(Exception e, string info)
        {
            MessageBox.Show(e.Message, " info: " + info);
        }
    }
}
